package com.example.master.mapper;

import com.example.master.entity.Service;
import com.example.master.entity.vo.*;
import org.apache.ibatis.annotations.*;

import java.util.*;

/**
 * @Author Mr.Yuan
 * @Date 2023/2/7 15:40
 * @PackageName:com.example.master.mapper
 * @ClassName: ServiceMapper
 * @Description: TODO
 * @Version 1.0
 */
@Mapper
public interface ServiceMapper {
    @Select("SELECT\n" +
            "\ts.id,\n" +
            "\ts.remark,\n" +
            "\ts.price,\n" +
            "\ts.service_img,\n" +
            "  u.nick_name\n" +
            "FROM\n" +
            "\ttb_service AS s\n" +
            "JOIN\n" +
            "\ttb_game AS g\n" +
            "ON\n" +
            "s.game_id = g.id\n" +
            "JOIN\n" +
            "tb_user as u\n" +
            "ON\n" +
            "s.create_by = u.id\n" +
            "WHERE g.id = #{id}")
    List<ServiceVo> findAll(Integer gameId);


    @Select("select * from tb_service where id=#{id} and status=1 and check_status=1")
    Service getServiceById(@Param("id") Integer id);


}
